package neuralNetworks;

public enum Functions {
	tanh,logistisch;
	
	public double calc(double x) {
		if (this == tanh)
			return calcTanh(x);
		return calcLogistisch(x);
	}
	
	public double calcD(double x) {
		if (this == tanh)
			return calcDTanh(x);
		return calcDLogistisch(x);
	}

	public double calcLogistisch(double x) {
		return 1. / (1. + Math.exp(-x));
	}

	public double calcTanh(double x) {
		return Math.tanh(x);
	}
	
	public double calcDLogistisch(double fx) {
		return fx * (1. - fx);
	}

	public double calcDTanh(double fx) {
		return 1.-(fx*fx);
	}
}
